package cn.sportvip;

import java.math.BigDecimal;

public abstract class Sport {
	/**
	 * 运动项目
	 * @author tao
	 */
	public enum Event {
		/**拳击*/
		BOXING,
		PINGPONG,
		BASKETBALL,
		BOWLING,
		BADMINTON
		
	}
	/**性别*/
	public enum Gender {
		/**男*/
		MALE,
		/**女*/
		FEMALE,
		/**未填*/
		NOT_INPUT
	}
	/**年龄段*/
	public enum AGE {
		/**幼儿*/
		YOUER,
		/**小学*/
		XIAOXUE,
		/**初中*/
		CHUZHONG,
		/**高中*/
		GAOZHONG,
		/**成人*/
		CHENGREN
	}
	/**历史课程类型*/
	public enum HIS {
		/**查看过的*/
		VIEW,
		/**联系过的*/
		CONTACT;
	}
	
	/**
	 * 计算地理两点之间距离
	 * @param _lat1 - start纬度
	 * @param _lon1 - start经度
	 * @param _lat2 - end纬度
	 * @param _lon2 - end经度
	 * @return 单位米(四舍五入)
	 */
	public static double getDistance(double _lat1,double _lon1, double _lat2,double _lon2){
		double lat1 = (Math.PI/180)*_lat1;
		double lat2 = (Math.PI/180)*_lat2;
		
		double lon1 = (Math.PI/180)*_lon1;
		double lon2 = (Math.PI/180)*_lon2;
		
		//地球半径(米)
		double R = 6378137;
		double d =  Math.acos(Math.sin(lat1)*Math.sin(lat2)+Math.cos(lat1)*Math.cos(lat2)*Math.cos(lon2-lon1))*R;
		return new BigDecimal(d).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
	}
	public static void main(String[] args) {
		System.out.println(getDistance(31.195850, 121.537910, 31.231297, 121.536225));
	}
	
}
